Skip to content

Don't preallocate based on bsatn length prefix#5343

Merged
bfops merged 1 commit into
masterfrom
joshua/fix/sats-proptest-oom
Jun 16, 2026
Merged

Don't preallocate based on bsatn length prefix#5343
bfops merged 1 commit into
masterfrom
joshua/fix/sats-proptest-oom

Conversation

@joshua-spacetime

@joshua-spacetime joshua-spacetime commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description of Changes

Fixes an OOM kill in the proptest bsatn_invalid_wont_decode.

bsatn_invalid_wont_decode generates arbitrary invalid bytes, proves validation fails, then still calls full AlgebraicValue::decode. For generated array-like types, decode reads a u32 length prefix, and the generic array visitor then reserves that capacity. But because they're random bytes, this could cause a huge initial allocation which could OOM kill the test process.

Now the visitor reserves a smaller initial capacity instead of assuming the binary input data is well formed.

API and ABI breaking changes

N/A

Expected complexity level and risk

1

Testing

This should fix the flaky spacetimedb-sats Test Suite failures that occasionally end in a SIGKILL.

@clockwork-labs-bot clockwork-labs-bot added this pull request to the merge queue Jun 16, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 16, 2026
@bfops bfops added this pull request to the merge queue Jun 16, 2026
Merged via the queue into master with commit f264511 Jun 16, 2026
37 checks passed
@joshua-spacetime joshua-spacetime deleted the joshua/fix/sats-proptest-oom branch June 16, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants